# Importing Data
SLOVAKIA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "AB1:AB229")

# Checking the Imported Data
View(SLOVAKIA)
# Creating Time Series Data
SLOVAKIA_ts <- ts(SLOVAKIA, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
SLOVAKIA_ts
sum(is.na(SLOVAKIA_ts))
library(forecast)
SLOVAKIA_ts <- tsclean(SLOVAKIA_ts)
SLOVAKIA_ts

# Identification: Plotting the Time Series Data
plot(SLOVAKIA_ts)

# Estimating the appropriate model
SLOVAKIA_ts_model <- auto.arima(SLOVAKIA_ts)
SLOVAKIA_ts_model

# Forecasting
options(max.print=1000000)
SLOVAKIA_ts_forecast <- forecast (SLOVAKIA_ts_model, level=c(95), h=288)
plot(SLOVAKIA_ts_forecast)
SLOVAKIA_ts_forecast             

# Exporting
write.table(SLOVAKIA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/SLOVAKIA_TSA.csv", sep=",")
